package com.lottery.ruok.lottrey.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import com.lottery.ruok.lottrey.adapter.fragmentManager.ChargeFragmentManager;
import com.lottery.ruok.lottrey.fragment.ActivitiesInfoFragment;
import com.lottery.ruok.lottrey.fragment.ChargeItemsFragment;
import com.lottery.ruok.lottrey.retrofitModule.response.ActivityListResponse;
import com.lottery.ruok.lottrey.retrofitModule.response.GetPayTypeResponse;

import java.util.ArrayList;
import java.util.List;

public class ActivieViewpagerAdapter extends FragmentStatePagerAdapter {

    private List<ActivityListResponse.ListBean> mData;

    public ActivieViewpagerAdapter(FragmentManager fm, List<ActivityListResponse.ListBean> mData) {
        super(fm);
        this.mData = mData;
    }

    public void setData(List<ActivityListResponse.ListBean> mData) {
        this.mData = mData;
    }

    @Override
    public Fragment getItem(int position) {
        return getFragment(position);
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    private Fragment getFragment(int position) {
        Fragment fragment = new ActivitiesInfoFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("data", mData.get(position));
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public int getCount() {
        return mData.size();
    }
}
